//
//  UIButton-Extension.swift
//  JIMWeiBo
//
//  Created by 陈恒均 on 2018/2/9.
//  Copyright © 2018年 陈恒均. All rights reserved.
//

import UIKit

extension UIButton{
    convenience init(imageName:String,bgImageName:String) {
        self.init()
        
        setImage(UIImage(named: imageName), for: .normal)
        setImage(UIImage(named: imageName + "_highlighted"), for: .highlighted)
        setBackgroundImage(UIImage(named: bgImageName), for: .normal)
        setBackgroundImage(UIImage(named: bgImageName + "_highlighted"), for: .highlighted)
        sizeToFit()
    }
    
    convenience init(bgcolor : UIColor , fontSize : CGFloat ,title : String) {
        self.init()
        
        setTitle(title, for: .normal)
        backgroundColor = bgcolor
        titleLabel?.font = UIFont.systemFont(ofSize: fontSize)
    }
}
